
<body>
    <div class="x-body">
        <form class="layui-form">
            <div class="layui-form-item">
                <label for="L_username" class="layui-form-label">
                    昵称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="L_username" name="username" disabled="" value="<?php echo $user['nickname'] ?>" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">
                    <span class="x-red">*</span>新密码
                </label>
                <div class="layui-input-inline">
                    <input type="password" id="L_pass" name="password" required="" lay-verify="required"
                    autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    6到16个字符
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                    <span class="x-red">*</span>确认密码
                </label>
                <div class="layui-input-inline">
                    <input type="password" id="L_repass" name="repassword" required="" lay-verify="required"
                    autocomplete="off" class="layui-input">
                </div>
            </div>
            <input type="hidden" name='uid' value="<?php echo $user['uid']; ?>">
            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="save" lay-submit="">
                    增加
                </button>
            </div>
        </form>
    </div>
    <script>
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form()
          ,layer = layui.layer;
        
          //监听提交
          form.on('submit(save)', function(data){
            $.ajax({
              url: "{:U('admin/memberpassword/edit')}",
              type: 'POST',
              dataType: 'json',
              data: data.field,
            })
            .done(function(res) {
              if(res.error==0){
                layer.alert(res.info, {icon: 6},function () {
                    // 获得frame索引
                  var index = parent.layer.getFrameIndex(window.name);
                    //关闭当前frame
                  parent.layer.close(index);
                  parent.location.reload();
                });
              }else{
                layer.msg(res.info, function () {
                    
                });
              }
            })
            .fail(function() {
              console.log("error");
            })
            return false;
          });
          
          
        });
    </script>
    <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
</body>